package edu.buct.controller;

import core.api.BaseResponse;
import edu.buct.entity.Total;
import edu.buct.service.TotalService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;


/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author ZYM
 * @since 2023-04-28
 */
@Api(tags = "机房总信息")
@RequestMapping("/macroom/total")
public class TotalController {
    @Resource
    private TotalService totalService;

    @ApiOperation("查询机房回路1信息")
    @GetMapping("/all")
    BaseResponse<Total> selectAll(){
        return totalService.selectAll();
    }

    @ApiOperation("新增机房回路1信息")
    @PostMapping("/insert")
    BaseResponse insert(Total total){
        return totalService.insert(total);
    }

    @ApiOperation("根据id删除机房回路1信息")
    @ApiImplicitParam(name = "id",value = "气候id",required = true)
    @GetMapping("/remove/{id}")
    BaseResponse delete(@PathVariable("id") Integer id){
        return totalService.delete(id);
    }

    @ApiOperation("根据id修改机房回路1信息")
    @PostMapping("/update")
    BaseResponse<Total> updateInfo(Total total){
        return totalService.updateInfo(total);
    }
}
